#include <SDL2/SDL.h>
#include "projection.h"

SDL_Point projectToIsometric(int x, int y, int height, int mulx, int muly)
{
    SDL_Point pos;
    pos.x = (x - y) * 0.5 * mulx;
    pos.y = (x + y) * 0.5 * muly + height;
    return pos;
}

SDL_Point projectFromIsometric(int x, int y, int divx, int divy)
{
    SDL_Point res;
    divx /= 2;
    divy /= 2;

    res.x = (x / divx +  y / divy)  / 2;
    res.y = (y / divy - (x / divx)) / 2;
    return res;
}
